package cn.wh.proxy;

import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Author wanghao
 * @Date 2022-05-16 22:20
 * @Description: TODO
 */
public class ProxyDemo<T> implements InvocationHandler, Serializable {

    private final Class<T> fly;
    private String s;

    public ProxyDemo(Class<T> fly, String s) {
        this.fly = fly;
        this.s = s;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("你被代理了:" + fly.getName() + ":" + s+method.getName());
        return null;
    }
}
